package com.forum.module.system.convert.file;

import com.forum.framework.common.util.colletion.CollectionUtils;
import com.forum.framework.common.util.object.BeanUtils;
import com.forum.module.system.controller.admin.file.vo.FileRespVO;
import com.forum.module.system.dal.dataobject.file.FileDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface FileConvert {
    FileConvert INSTANCE = Mappers.getMapper(FileConvert.class);

    default List<FileRespVO> covertList(List<FileDO> list) {
        return CollectionUtils.convertList(list, this::covert);
    }

    default FileRespVO covert(FileDO fileDO) {
        return BeanUtils.toBean(fileDO, FileRespVO.class);
    }
}
